﻿<!DOCTYPE html>
<html ng-app="demoApp">
<head>
    <title id="Description">jqxTreeMap directive for AngularJS</title>
    <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../scripts/angular.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxtreemap.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function () {
            var vm = this;
            vm.data = [
            {
                label: 'USA',
                value: 104
            },
            {
                label: 'People\'s Republic of China',
                value: 88
            },
            {
                label: 'Great Britain',
                value: 65
            },
            {
                label: 'Russian Federation',
                value: 82
            },
            {
                label: 'Germany',
                value: 44
            },
            {
                label: 'Republic of Korea',
                value: 28
            },
            {
                label: 'France',
                value: 34
            },
            {
                label: 'Italy',
                value: 28
            },
            {
                label: 'Hungary',
                value: 17
            },
            {
                label: 'Australia',
                value: 35
            },
            {
                label: 'Japan',
                value: 38
            },
            {
                label: 'Kazakhstan',
                value: 13
            },
            {
                label: 'Netherlands',
                value: 20
            },
            {
                label: 'Ukraine',
                value: 20
            },
            {
                label: 'New Zealand',
                value: 13
            },
            {
                label: 'Cuba',
                value: 14
            }
            ];
            vm.treeMapSettings =
                {
                    width: 800,
                    showLegend: false,
                    height: 400,
                    colorRange: 100,
                    colorMode: 'autoColors',
                    baseColor: '#52CBFF'
                }


            vm.changeData = function () {
                vm.data = [
                  {
                      label: 'USA',
                      value: 134
                  },
                  {
                      label: 'People\'s Republic of China',
                      value: 99
                  },
                  {
                      label: 'Great Britain',
                      value: 70
                  },
                  {
                      label: 'Russian Federation',
                      value: 88
                  },
                  {
                      label: 'Germany',
                      value: 48
                  },
                  {
                      label: 'Republic of Korea',
                      value: 28
                  },
                  {
                      label: 'France',
                      value: 34
                  },
                  {
                      label: 'Italy',
                      value: 38
                  },
                  {
                      label: 'Hungary',
                      value: 17
                  },
                  {
                      label: 'Australia',
                      value: 35
                  },
                  {
                      label: 'Japan',
                      value: 48
                  }
                ];
                //vm.$apply();
            }
        });
    </script>
</head>
<body>
    <div ng-controller="demoController as vm">
        <jqx-tree-map jqx-source="vm.data" jqx-settings="vm.treeMapSettings"></jqx-tree-map>
        <br />
        <br />
        <jqx-button jqx-on-click="vm.changeData()">Change Data</jqx-button>
    </div>
</body>
</html>
